package com.internetCafes.spms.core.exception;

/**
 * 自定义异常
 *
 * @author Sunny
 * @email rekeeper2011@hotmail.com
 * @date 2016年10月27日 下午10:11:27
 */
public class RRException extends RuntimeException {
	private static final long serialVersionUID = 1L;

    private String message;
    private int code = 500;
	private Object data;

	public RRException(RRExceptionCodeEnum codeEnum) {
		super(codeEnum.getMessage());
		this.message = codeEnum.getMessage();
		this.code = codeEnum.getCode();
	}

	public RRException(RRExceptionCodeEnum codeEnum, Object data) {
		super(codeEnum.getMessage());
		this.message = codeEnum.getMessage();
		this.code = codeEnum.getCode();
		this.data = data;
	}

    public RRException(String msg) {
		super(msg);
		this.message = msg;
	}

	public RRException(String msg, Throwable e) {
		super(msg, e);
		this.message = msg;
	}

	public RRException(String msg, int code) {
		super(msg);
		this.message = msg;
		this.code = code;
	}

	public RRException(String msg, int code, Object data) {
		super(msg);
		this.message = msg;
		this.code = code;
		this.data = data;
	}

	public RRException(String msg, int code, Throwable e) {
		super(msg, e);
		this.message = msg;
		this.code = code;
	}

	public String getMsg() {
		return message;
	}

	public void setMsg(String msg) {
		this.message = msg;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	@Override
	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
}
